﻿using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using mozhi.smarterp.Finance.Organizations;
using System.Threading.Tasks;

namespace mozhi.smarterp.Finance
{
    [RemoteService]
    [Route("api/v1/organizations")]
    public class OrganizationController : BaseController
    {
        private IOrganizationAppService _appService;

        public OrganizationController(IOrganizationAppService appService)
        {
            this._appService = appService;
        }

        [HttpGet]
        public async Task<OrganizationDto> GetAsync()
        {
            return await _appService.FindAsync(default);
        }

        [HttpPut]
        [Route("base")]
        public async Task<OrganizationDto> UpdateBaseInfoAsync(OrganizationUpdateDto dto)
        {
            return await _appService.UpdateBaseInfoAsync(dto);
        }

        [HttpPut]
        [Route("finance")]
        public async Task<OrganizationDto> UpdateFinanceInfoAsync(OrganizationUpdateDto dto)
        {
            return await _appService.UpdateFinanceInfoAsync(dto);
        }
    }
}
